
package com.tabel.model;

import com.data.enty.DokumenMasuk;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Blasius
 */
public class DokumenMasukTabelModel extends AbstractTableModel{
       List<DokumenMasuk> isi = new ArrayList<DokumenMasuk>();

    public DokumenMasukTabelModel(List<DokumenMasuk> list) {
        int row = list.size();
        for (int i = 0; i < row; i++) {
           DokumenMasuk sm = (DokumenMasuk) list.get(i);
            isi.add(sm);
        }
    }

    @Override
    public int getRowCount() {
        return isi.size();
    }

    @Override
    public int getColumnCount() {
        return 6;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        switch (columnIndex) {
            case 0:
                return isi.get(rowIndex).getNoDokumen();
            case 1:
                return isi.get(rowIndex).getPerihal();
            case 2:
                return isi.get(rowIndex).getTanggalDokumen();
            case 3:
                return isi.get(rowIndex).getTanggalTerima();
            case 4:
                return isi.get(rowIndex).getPengirim();
            case 5:
                return isi.get(rowIndex).getPenerima();
            default:
                return null;
        }
    }

    @Override
    public String getColumnName(int column) {
        switch (column) {
            case 0:
                return "No. Surat";
            case 1:
                return "Perihal";
            case 2:
                return "Tanggal Dokumen";
            case 3:
                return "Tanggal Terima";
            case 4:
                return "Pengirim";
            case 5:
                return "Penerima";
            default:
                return null;
        }
    }
}

   

